package com.gaoyubo.service;

import com.gaoyubo.entity.Oder;
import com.gaoyubo.entity.User;
import com.gaoyubo.mapper.OderMapper;
import com.gaoyubo.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Date;
import java.util.List;
import java.util.Optional;

@Service
public class UserServiceImpl implements UserService{
    @Autowired
    private UserMapper userMapper;
    @Autowired
    private OderMapper oderMapper;

    @Override
    public <U extends User> U save1(U u) {
        return userMapper.save(u);
    }

    @Override
    public <O extends Oder> O save2(O o) {
        return oderMapper.save(o);
    }

    @Override
    public Optional<User> findById(Integer id) {
        return userMapper.findById(id);
    }

    @Override
    public void deleteById(Integer id) {
        userMapper.deleteById(id);
    }

    @Override
    public List<User> findAllByBirthday(Date date) {
        return userMapper.findAllByBirthday(date);
    }
}
